import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../res/color_res.dart';


class PhotoActionSheet extends StatelessWidget {
  const PhotoActionSheet({
    super.key,
    required this.takePhotoAction,
    required this.pickPhotoAction,
    required this.cancelAction,
  });

  final Function takePhotoAction;
  final Function pickPhotoAction;
  final Function cancelAction;

  @override
  Widget build(BuildContext context) {
    return CupertinoActionSheet(
      title: Text(
        '选择一种方式',
        style: TextStyle(
          fontSize: 12.sp,
          fontWeight: FontWeight.normal,
          color: const Color(colorGrayB6),
        ),
        textAlign: TextAlign.center,
      ),
      actions: [
        CupertinoActionSheetAction(
          child: Text(
            '拍照',
            style: TextStyle(
              fontSize: 18.sp,
              fontWeight: FontWeight.normal,
              color: const Color(0xFF007AFF),
            ),
          ),
          onPressed: () {
            takePhotoAction.call();
          },
        ),
        CupertinoActionSheetAction(
          child: Text(
            '相册选取',
            style: TextStyle(
              fontSize: 18.sp,
              fontWeight: FontWeight.normal,
              color: const Color(0xFF007AFF),
            ),
          ),
          onPressed: () async {
            pickPhotoAction.call();
          },
        ),
      ],
      cancelButton: CupertinoActionSheetAction(
        child: Text(
          '取消',
          style: TextStyle(
            fontSize: 18.sp,
            fontWeight: FontWeight.normal,
            color: const Color(0xFF007AFF),
          ),
        ),
        onPressed: () {
          cancelAction.call();
        },
      ),
    );
  }
}
